﻿using Model;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DAL
{
    public class ShopinformDAL : PageDAL<ShopModel>
    {
        public ShopModel GetModelByID(string tableName, int pid)
        {
            string sql = $"select * from  {tableName} where id='{pid}'";
            DataTable dt = new DBHelper().GetDataTable(sql);
            ShopModel model = new ShopModel()
            {
                Id = int.Parse(dt.Rows[0]["id"].ToString()),
                Name = dt.Rows[0]["Name"].ToString(),
                Price = decimal.Parse(dt.Rows[0]["price"].ToString()),
                nPrice = decimal.Parse(dt.Rows[0]["nPrice"].ToString()),
                Num = int.Parse(dt.Rows[0]["num"].ToString())
            };
            return model;
        }

        public bool Gai(ShopModel model, int pid)
        {
            throw new NotImplementedException();
        }

        public bool Add(ShopModel model)
        {
            throw new NotImplementedException();
        }
    }
}
